home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 109
/
Vol 109.iso
/
games
/
athlete_.swf
/
scripts
/
frame_2
/
DoAction.as
Wrap
Text File
|
2008-11-12
|
6KB
|
271 lines
function setupplayers()
{
players = new Array(maxplayers);
i = 0;
while(i < maxplayers)
{
players[i] = new player();
i++;
}
pl.duplicateMovieClip("pl0",200);
cpl.duplicateMovieClip("pl1",201);
pl0.gotoAndStop(p1type);
pl1.gotoAndStop(p2type);
pl0.body._rotation = 90;
players[0].ballsready.push(0);
players[0].leftk = 90;
players[0].rightk = 88;
players[0].firek = 83;
pl1.body._rotation = 90;
players[1].ballsready.push(1);
players[1].mx = 294;
players[1].my = 522;
}
function player()
{
this.height = 10;
this.speed = 14;
this.leftk = 37;
this.rightk = 39;
this.firek = 38;
this.state = 0;
this.scale = 1;
this.loadspeed = 10;
this.firespeed = 5;
this.ballload = 0;
this.mx = 35;
this.my = 262;
this.ballsready = new Array();
this.ballsloaded = new Array();
this.cpuangle = 0;
}
function ballob()
{
this.speed = 18;
this.xstep = 0;
this.ystep = 0;
this.gravity = 0.6;
this.state = 0;
this.type = 1;
this.hitby = 0;
}
function setupballs()
{
balls = new Array(maxballs);
i = 0;
while(i < maxballs)
{
tbl = eval("ball" + i);
tbl.removeMovieClip();
testball.duplicateMovieClip("ball" + i,150 + i);
tbl = eval("ball" + i);
tbl.gotoAndStop(1);
balls[i] = new ballob();
i++;
}
}
function dropcreature(cno)
{
tg = eval("ground" + cno + "" + (players[cno].height - 1));
tp = eval("pl" + cno);
while(tp._y + 20 * players[cno].scale < tg._y + (players[cno].scale - 0.8) * 5)
{
tp._y = tp._y + 1;
}
}
function fireball(pno)
{
}
function removeboard()
{
i = 0;
while(i < maxplayers)
{
j = 0;
while(j < players[i].height)
{
temp2 = eval("ground" + i + "" + j);
temp2.removeMovieClip();
j++;
}
i++;
}
}
function setupboard()
{
i = 0;
while(i < maxplayers)
{
temp = eval("ground" + i);
temp._height = 160 / players[i].height;
j = 0;
while(j < players[i].height)
{
temp2 = eval("ground" + i + "" + j);
temp2.removeMovieClip();
temp.duplicateMovieClip("ground" + i + "" + j,i * players[i].height + j);
temp2 = eval("ground" + i + "" + j);
temp2._x = 147 + i * 267;
temp2._y = temp._y - (temp._height - 1);
temp2.gotoAndStop(j % 2 + 1);
temp = eval("ground" + i + "" + j);
j++;
}
cliff.swapDepths(100);
temp = eval("ground" + i);
temp._x = -300;
i++;
}
}
function setuptokens()
{
i = 0;
while(i < maxtokensout)
{
ttoken = eval("token" + i);
ttoken.removeMovieClip();
token.duplicateMovieClip("token" + i,99);
ttoken = eval("token" + i);
ttoken._x = -100;
ttoken._y = -97;
ttoken.gotoAndStop(1);
i++;
}
}
function setballtype(bno, bt)
{
btb = eval("ball" + bno);
btb.gotoAndStop(bt);
balls[bno].type = bt;
if(bt == 1)
{
balls[bno].gravity = 0.6;
balls[bno].speed = 18;
}
else if(bt == 2)
{
balls[bno].gravity = 0.1;
balls[bno].speed = 7;
}
else if(bt == 3)
{
balls[bno].gravity = 0.8;
balls[bno].speed = 22;
}
}
function placetoken()
{
placing = 0;
if(tokensout < maxtokensout)
{
tt = Math.floor(Math.random() * 550);
if(1 >= tt)
{
if(ballsout < maxballs)
{
placing = 1;
}
}
else if(tt == 2)
{
ib = 0;
while(ib < ballsout)
{
if(balls[ib].type != 2)
{
if(placing == 100)
{
placing = tt;
}
else
{
placing = 100;
}
}
ib++;
}
}
else if(tt == 3)
{
ib = 0;
while(ib < ballsout)
{
if(balls[ib].type != 1)
{
placing = tt;
}
ib++;
}
}
else if(tt == 4)
{
ib = 0;
while(ib < ballsout)
{
if(balls[ib].type != 3)
{
placing = tt;
}
ib++;
}
}
else if(tt == 5)
{
ib = 0;
while(ib < maxplayers)
{
if(1.4 >= players[ib].scale)
{
placing = tt;
}
ib++;
}
}
else if(tt == 6)
{
ib = 0;
while(ib < maxplayers)
{
if(players[ib].scale >= 1)
{
placing = tt;
}
ib++;
}
}
}
if(0 < placing && placing < 50)
{
ttoken = eval("token" + tokensout);
tokensout++;
ttoken.gotoAndStop(placing + 1);
ttoken._x = 70 + Math.random() * 425;
ttoken._y = 15 + Math.random() * 66;
}
}
maxplayers = 2;
maxballs = 6;
humanplayers = 2;
cpulevel = 15;
ballsout = 2;
mheight = 10;
tokensout = 0;
maxtokensout = 1;
p1type = 1;
p2type = 6;
diflevel = 0;
fireBall = new Sound();
fireBall.attachSound("fireBall");
levelGo = new Sound();
levelGo.attachSound("levelGo");
tokenPop = new Sound();
tokenPop.attachSound("tokenPop");
names = new Array();
names[0] = "Joel";
names[1] = "Carey";
names[2] = "Tim";
names[3] = "Steve";
names[4] = "quiet phil";
names[5] = "mortalbug";
setupplayers();